define(function(require, exports, module) {
    var ALL = require("../../common/all"),
        CONFIG = ALL.CONFIG,
        METHOD = ALL.METHOD,
        Dialog = ALL.Dialog,
        Init = ALL.Init;

    var _Dialog = new Dialog({
        title : "提示",
        content : "<p>是否确认通过审核？</p>",
        text4Btn: ["确定", "取消"],
        class4Btn: ["", "line"]
    });

    var _vm = Init.initVue({
        data : {
            list : [],
            schFlag : false,
            name : '',
            user_id : '',
            status : '',
            cur : 1,
            all : 0,
        },
        methods: {
            reSearch : function() {
                this.schFlag = true;
                this.getData(1);
            },
            reset : function() {
                this.schFlag = false;
                this.name = '';
                this.user_id = '';
                this.status = '';
            },
            getData : function(n) {
                var obj = {
                    page: n,
                    num: 10,
                    name: this.name,
                    user_id: this.user_id,
                    status: this.status
                };

                METHOD.loading.show();
                METHOD.ajax("collection/list_notissued",obj).done(function(json){
                    METHOD.loading.hide();
                    _vm.list = json.data;
                    _vm.all = json.page.pages;
                }).fail(function(){
                    METHOD.loading.hide();
                });
            },
            operate : function(id,status) {
                var url;

                if (status == 8) {
                    _Dialog.changeCfg({content : "<p>是否确认通过审核？</p>"});
                    url = "collection/operate/pass";
                } else if (status == 9) {
                    _Dialog.changeCfg({content : "<p>是否确认拒绝？</p>"});
                    url = "collection/operate/refuse";
                } else if (status == 0) {
                    _Dialog.changeCfg({content : "<p>是否确认删除？</p>"});
                    url = "collection/operate/delete";
                } else if (status == 10) {
                    _Dialog.changeCfg({content : "<p>是否确认停止申购？</p>"});
                    url = "collection/operate/stop/buy";
                };

                _Dialog.showUI(function(i) {
                    var obj = {};

                    obj.col_id = id;

                    if (status == 10) {
                        obj.status = 8;
                    } else {
                        obj.status = status;
                    }

                    if (i == 0) {
                        METHOD.loading.show();
                        METHOD.ajax(url, {data:JSON.stringify(obj)}, {type:"post"}).done(function(json){
                            METHOD.loading.hide();
                            _vm.getData(1);
                        }).fail(function(){
                            METHOD.loading.hide();
                        });
                    }
                    this.hideUI();
                });
            }
        }
    });

    _vm.getData(1);
});

